<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of BConfig
 *
 * @author ID59C
 */
class BConfig {

    protected $parent = null;
    public $configPath = null;
    public $configFileName = 'config';
    protected $config = array();

    public function __construct($parent) {
        $this->parent = $parent;
        $this->init();
        $this->config = $this->parseConfig();
    }

    public function init() {
        
    }

    //should return array that contain config information
    public function parseConfig() {
        $configFile = $this->parent->configPath . '.' . $this->configFileName;

        $file = Yii::getPathOfAlias($configFile) . '.php';

        if (file_exists($file)) {
            $config = require($file);
            return $config;
        }

        return FALSE;
    }

    public function getConfig($name) {
        if (isset($this->config[$name]))
            return $this->config[$name];

        return array();
    }
    
    public function saveConfig($config)
    {}

}

?>
